/*************
Ten tac gia : LY THIEN KIM
Ngay tao : 8/16/2011
Noi dung : update 1 CRIMINAL_REG

*************/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE NAME = 'sp_UpdateCRIMINAL_REG')
BEGIN
	DROP PROC sp_UpdateCRIMINAL_REG
END
GO
CREATE PROC sp_UpdateCRIMINAL_REG
	@ID				int,
	@IDUSER			int,
	@FIRSTNAME		varchar(40),
	@SEX			int,
	@ADDRESS		varchar(50),
	@LASTNAME		varchar(40),
	@IMAGE			text,
	@BIRTH			datetime,
	@Last_updated	datetime,
	@Result			int out
	AS
	BEGIN	
		IF EXISTS (SELECT * FROM CRIMINAL_REG WHERE ID = @ID and IDUSER = @IDUSER)
		BEGIN
			UPDATE CRIMINAL_REG SET  @FIRSTNAME = @FIRSTNAME,@SEX = @SEX,ADDRESS = @ADDRESS,@LASTNAME = @LASTNAME,@IMAGE = @IMAGE,@BIRTH = @BIRTH,Last_updated = @Last_updated
			WHERE ID = @ID and IDUSER = @IDUSER
			SET @Result = 1	
		END
		else
		BEGIN
			SET @Result = 0
		END
	END